<?php
/**
 * Created by PhpStorm.
 * User: Shen
 * Date: 2016/7/19
 * Time: 22:01
 */
namespace DuiCode\Database;

use DuiCode\IDatabase;

class PDO implements IDatabase{

    protected $conn;

    function connect($host, $user, $passwd, $dbname){
        // TODO: Implement connect() method.
        $conn = new \PDO("mysql:host=$host;dbname=$dbname", $user, $passwd);
        $this->conn = $conn;
    }

    function query($sql){
        // TODO: Implement query() method.
        return $this->conn->query($sql);
    }

    function close(){
        // TODO: Implement close() method.
        unset($this->conn);
    }
}